﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class MasterPage : System.Web.UI.MasterPage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.IsPostBack)
        {
            this.ddl_lang.DataBind();
            if (System.Configuration.ConfigurationManager.AppSettings["WebLanguage"] == "zh-tw")
            {
                this.ddl_lang.Items.FindByValue("tw").Selected = true;
            }
            else
            {
                this.ddl_lang.Items.FindByValue("cn").Selected = true;
            }
        }
    }

    protected void ddl_lang_SelectedIndexChanged(object sender, EventArgs e)
    {
        string url = "";
        if (this.ddl_lang.SelectedValue == "tw")
        {
            url = System.Configuration.ConfigurationManager.AppSettings["Web_zhtw_Path"];
        }
        if (this.ddl_lang.SelectedValue == "cn")
        {
            url = System.Configuration.ConfigurationManager.AppSettings["Web_zhch_Path"];
        }
        if (!string.IsNullOrEmpty(url))
        {
            Response.Redirect(url);
        }
        
    }
}
